//
//  DraggableVelocitySystem.h
//  Cubism
//
//  Created by Jeppe Nielsen on 9/10/14.
//  Copyright (c) 2014 Jeppe Nielsen. All rights reserved.
//

#pragma once
#include "GameWorld.hpp"
#include "Draggable.hpp"
#include "DraggableMotion.hpp"
#include "Velocity.hpp"
#include "Transform.hpp"
#include <map>
#include <vector>

namespace Nano {
    class DraggableMotionSystem : public GameSystem {
    public:
        void Initialize();
        void ObjectAdded(GameObject* object);
        void ObjectRemoved(GameObject* object);
        void Update(float dt);
        
    private:
        
        void DraggingChanged(Draggable* draggable, GameObject* object);
    
        struct DraggingData {
            GameObject* object;
            Vector3 lastPosition;
            std::vector<Vector3> velocities;
        };
        
        typedef std::map<Draggable*, DraggingData> DraggingObjects;
        DraggingObjects draggingObjects;
        
    };
}